package caraocruz;

import java.util.*;
import javax.swing.*;

public class Cara {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		try {
			
			int n = sc.nextInt();

			int ri[] = new int[n];

			for (int i = 0; i <= (n - 1); i++) {
				ri[i] = sc.nextInt();
			}
			int x = 0;
			int y = 0;
			for (int i = 0; i <= (n - 1); i++) {
				if (ri[i] == 1) {
					x++;
				}
				if (ri[i] == 0) {
					y++;
				}
			}

			System.out.println("Mary won " + x + " times and Jhon won " + y
					+ " times");
		} catch (InputMismatchException e) {
			System.out.print("ingrese un numero valido");
		}
	}
}